<% /* $Id: users.jsp 132 2011-08-26 10:23:42Z altdotua@gmail.com $ */ %>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%@ include file="../header.jsp" %>

<h2>Users</h2>

<%= DJudgeUtils.generateTable(request, response, UserEntry.class, UsersModel.getCore()) %>

<%
	UserEntry entry = UsersModel.getUser(Long.parseLong(request.getParameter("id")));
%>
<h2><%= entry == null ? "Add user" : "Edit user \"" + entry + "\"" %></h2>

<form action="<%= Linker.link("users") %>" method="post">
	<input type="hidden" name="action" value="edit">
	<input type="hidden" name="id" value="<%= null == entry ? "" : entry.getId() %>">
  <p>Username: <input name="username" value="<%= null == entry ? "" : entry.getUsername() %>"></p>
  <p>Role: <input name="role" value="<%= null == entry ? "" : entry.getRole() %>"></p>
  <p>Password: <input name="password" value="<%= null == entry ? "" : entry.getPassword() %>"></p>
  <p><input type="submit" value="Submit"></p>
</form>


<%@ include file="../footer.jsp" %>
